{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from __future__ import print_function\n",
    "\n",
    "import numpy as np\n",
    "import tempfile\n",
    "import tensorflow as tf\n",
    "\n",
    "from tf_rl.controller import DiscreteDeepQ, HumanController\n",
    "from tf_rl.simulation import KarpathyGame\n",
    "from tf_rl import simulate\n",
    "from tf_rl.models import MLP\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/tmp/tmp7dz3utz0\n"
     ]
    }
   ],
   "source": [
    "LOG_DIR = tempfile.mkdtemp()\n",
    "print(LOG_DIR)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "current_settings = {\n",
    "    'objects': [\n",
    "        'friend',\n",
    "        'enemy',\n",
    "    ],\n",
    "    'colors': {\n",
    "        'hero':   'yellow',\n",
    "        'friend': 'green',\n",
    "        'enemy':  'red',\n",
    "    },\n",
    "    'object_reward': {\n",
    "        'friend': 0.1,\n",
    "        'enemy': -0.1,\n",
    "    },\n",
    "    'hero_bounces_off_walls': False,\n",
    "    'world_size': (700,500),\n",
    "    'hero_initial_position': [400, 300],\n",
    "    'hero_initial_speed':    [0,   0],\n",
    "    \"maximum_speed\":         [50, 50],\n",
    "    \"object_radius\": 10.0,\n",
    "    \"num_objects\": {\n",
    "        \"friend\" : 25,\n",
    "        \"enemy\" :  25,\n",
    "    },\n",
    "    \"num_observation_lines\" : 32,\n",
    "    \"observation_line_length\": 120.,\n",
    "    \"tolerable_distance_to_wall\": 50,\n",
    "    \"wall_distance_penalty\":  -0.0,\n",
    "    \"delta_v\": 50\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# create the game simulator\n",
    "g = KarpathyGame(current_settings)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "human_control = False\n",
    "\n",
    "if human_control:\n",
    "    # WSAD CONTROL (requires extra setup - check out README)\n",
    "    current_controller = HumanController({b\"w\": 3, b\"d\": 0, b\"s\": 1,b\"a\": 2,}) \n",
    "else:\n",
    "    # Tensorflow business - it is always good to reset a graph before creating a new controller.\n",
    "    tf.reset_default_graph()\n",
    "    session = tf.InteractiveSession()\n",
    "\n",
    "    # This little guy will let us run tensorboard\n",
    "    #      tensorboard --logdir [LOG_DIR]\n",
    "    journalist = tf.train.SummaryWriter(LOG_DIR)\n",
    "\n",
    "    # Brain maps from observation to Q values for different actions.\n",
    "    # Here it is a done using a multi layer perceptron with 2 hidden\n",
    "    # layers\n",
    "    brain = MLP([g.observation_size,], [200, 200, g.num_actions], \n",
    "                [tf.tanh, tf.tanh, tf.identity])\n",
    "    \n",
    "    # The optimizer to use. Here we use RMSProp as recommended\n",
    "    # by the publication\n",
    "    optimizer = tf.train.RMSPropOptimizer(learning_rate= 0.001, decay=0.9)\n",
    "\n",
    "    # DiscreteDeepQ object\n",
    "    current_controller = DiscreteDeepQ((g.observation_size,), g.num_actions, brain, optimizer, session,\n",
    "                                       discount_rate=0.99, exploration_period=5000, max_experience=10000, \n",
    "                                       store_every_nth=4, train_every_nth=4,\n",
    "                                       summary_writer=journalist)\n",
    "    \n",
    "    session.run(tf.initialize_all_variables())\n",
    "    session.run(current_controller.target_network_update)\n",
    "    # graph was not available when journalist was created  \n",
    "    journalist.add_graph(session.graph)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<?xml version=\"1.0\"?>\n",
       "\n",
       "<svg height=\"600\" width=\"720\" >\n",
       "\n",
       " <g style=\"fill-opacity:1.0; stroke:black;\n",
       "\n",
       "  stroke-width:1;\">\n",
       "\n",
       "  <rect x=\"10\" y=\"10\" height=\"500\"\n",
       "\n",
       "        width=\"700\" style=\"fill:none;\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"373\" y2=\"387\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"371\" y2=\"410\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"364\" y2=\"433\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"353\" y2=\"454\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"338\" y2=\"472\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"320\" y2=\"487\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"299\" y2=\"498\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"277\" y2=\"505\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"253\" y2=\"507\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"230\" y2=\"505\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"207\" y2=\"498\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"186\" y2=\"487\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"168\" y2=\"472\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"153\" y2=\"454\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"142\" y2=\"433\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"135\" y2=\"410\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"133\" y2=\"387\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"135\" y2=\"364\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"142\" y2=\"341\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"153\" y2=\"320\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"168\" y2=\"302\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"186\" y2=\"287\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"207\" y2=\"276\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"230\" y2=\"269\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"253\" y2=\"267\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"277\" y2=\"269\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"299\" y2=\"276\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"320\" y2=\"287\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"338\" y2=\"302\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"353\" y2=\"320\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"364\" y2=\"341\" />\n",
       "\n",
       "  <line x1=\"253\" y1=\"387\" x2=\"371\" y2=\"364\" />\n",
       "\n",
       "  <circle cx=\"43\" cy=\"41\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"544\" cy=\"390\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"371\" cy=\"393\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"240\" cy=\"195\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"359\" cy=\"133\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"433\" cy=\"417\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"213\" cy=\"367\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"673\" cy=\"138\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"105\" cy=\"430\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"329\" cy=\"91\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"330\" cy=\"406\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"417\" cy=\"460\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"688\" cy=\"203\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"442\" cy=\"40\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"338\" cy=\"261\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"40\" cy=\"202\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"186\" cy=\"29\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"624\" cy=\"494\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"277\" cy=\"407\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"161\" cy=\"313\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"482\" cy=\"60\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"321\" cy=\"248\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"300\" cy=\"336\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"514\" cy=\"244\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"623\" cy=\"437\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"690\" cy=\"330\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"677\" cy=\"411\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"242\" cy=\"46\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"249\" cy=\"260\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"140\" cy=\"482\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"222\" cy=\"343\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"598\" cy=\"311\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"387\" cy=\"24\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"151\" cy=\"41\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"280\" cy=\"325\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"74\" cy=\"377\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"262\" cy=\"125\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"504\" cy=\"52\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"234\" cy=\"86\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"228\" cy=\"290\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"676\" cy=\"78\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"267\" cy=\"137\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"148\" cy=\"241\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"590\" cy=\"117\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"654\" cy=\"24\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"510\" cy=\"492\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"255\" cy=\"262\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"296\" cy=\"26\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"396\" cy=\"41\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"182\" cy=\"202\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"253\" cy=\"387\" r=\"10\"\n",
       "\n",
       "          style=\"fill:yellow;\" />\n",
       "\n",
       "  <text x=\"10\" y=\"535\" font-size=\"15\">\n",
       "\n",
       "   fps = 108.6\n",
       "\n",
       "  </text>\n",
       "\n",
       "  <text x=\"10\" y=\"555\" font-size=\"15\">\n",
       "\n",
       "   nearest wall = 112.5\n",
       "\n",
       "  </text>\n",
       "\n",
       "  <text x=\"10\" y=\"575\" font-size=\"15\">\n",
       "\n",
       "   reward       = -0.0\n",
       "\n",
       "  </text>\n",
       "\n",
       "  <text x=\"10\" y=\"595\" font-size=\"15\">\n",
       "\n",
       "   objects eaten => friend: 191, enemy: 144\n",
       "\n",
       "  </text>\n",
       "\n",
       " </g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<tf_rl.utils.svg.Scene instance at 0x110cb7a70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Interrupted\n"
     ]
    }
   ],
   "source": [
    "FPS          = 30\n",
    "ACTION_EVERY = 3\n",
    "    \n",
    "fast_mode = True\n",
    "if fast_mode:\n",
    "    WAIT, VISUALIZE_EVERY = False, 50\n",
    "else:\n",
    "    WAIT, VISUALIZE_EVERY = True, 1\n",
    "\n",
    "    \n",
    "try:\n",
    "    with tf.device(\"/cpu:0\"):\n",
    "        simulate(simulation=g,\n",
    "                 controller=current_controller,\n",
    "                 fps=FPS,\n",
    "                 visualize_every=VISUALIZE_EVERY,\n",
    "                 action_every=ACTION_EVERY,\n",
    "                 wait=WAIT,\n",
    "                 disable_training=False,\n",
    "                 simulation_resolution=0.001,\n",
    "                 save_path=None)\n",
    "except KeyboardInterrupt:\n",
    "    print(\"Interrupted\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "session.run(current_controller.target_network_update)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.00824914, -0.04792793,  0.08260646, ..., -0.00135659,\n",
       "        -0.0149605 , -0.00065048],\n",
       "       [ 0.04895933, -0.01720949,  0.03015076, ...,  0.04350275,\n",
       "        -0.00071916, -0.00507376],\n",
       "       [-0.03408033, -0.00734746, -0.07286905, ...,  0.06636748,\n",
       "         0.0507561 ,  0.04723936],\n",
       "       ..., \n",
       "       [-0.01454929, -0.00313209,  0.02152171, ...,  0.01723659,\n",
       "        -0.01757577, -0.02262094],\n",
       "       [ 0.03226471, -0.09545884,  0.01721121, ...,  0.0179732 ,\n",
       "        -0.01188065,  0.03430547],\n",
       "       [ 0.02971489,  0.06272104, -0.05087573, ..., -0.00265156,\n",
       "        -0.00139228,  0.01183042]], dtype=float32)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_controller.q_network.input_layer.Ws[0].eval()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.00792158, -0.04618821,  0.08227044, ..., -0.00076906,\n",
       "        -0.01525626, -0.00064818],\n",
       "       [ 0.04957703, -0.01709567,  0.03077196, ...,  0.04223152,\n",
       "        -0.00179744, -0.00452804],\n",
       "       [-0.03365123, -0.00761478, -0.07296818, ...,  0.0649555 ,\n",
       "         0.0494989 ,  0.04785381],\n",
       "       ..., \n",
       "       [-0.01843384, -0.00160771,  0.02573192, ...,  0.01739593,\n",
       "        -0.01991378, -0.01864818],\n",
       "       [ 0.03407663, -0.09417476,  0.01543032, ...,  0.01674915,\n",
       "        -0.00885472,  0.03387342],\n",
       "       [ 0.02986682,  0.06386744, -0.05153623, ..., -0.00791921,\n",
       "        -0.00157495,  0.01063347]], dtype=float32)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_controller.target_q_network.input_layer.Ws[0].eval()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Average Reward over time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAEACAYAAAB27puMA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xJitXQiRii2IowkViIoRISzRq4lFf\nDy0tEhPRGYmJECItfjFZvBgaGyUmIh6JiRCiS37yE2vaamz0xKTUPJM774THHy+2FZWNAvBCiC6Z\nOhXuvRf69i1dMfnWt6y32RlnFNuSykWeiRAiJdu321iSc86x/fp6WLbME5PW1uLa56dv32JbUNlI\nTIQQKWlvNwGpciZyra+3dSRizV7uIMZi0t5u6x56mhUVff1CiJS4YuLiF5O6OqipgU2bimObi+sd\nuaIiioPERAiRkkQxcT2UPn1sXQpxk2gUdt9dYlJsJCZCiJQkisnw4bZ2RSUSgenTbX/Fitxcc7fd\n4NFHg5ePRmHMGIlJsZGYCCFSkigmt98eHyOJRODll217yZLcXHPrVnj11eDlJSalgcRECJGSRDFJ\nJBKBd9+17WI1d/nFpNidASoZiYkQIiVBxMQNgOdCTNyU9pmkto9GLelkz57m1YjiIDERQqSkvR16\n9079eSRi6332yY2YbNhg67a24HX8qV7U1FU8JCZCiJTMnBlMTPbbD55/3mvySqSjA155xdtftszi\nL/Pm2f6uXdDcDH/5i+37pwl+773U19+0CZ56yuzYtg3+7/8C3ZbIAxITIURKHnoITj459eef+Qxc\nfjlceSVUV8OttyYvd8stcOih3v6DD8L3vgd33GH7//gHHHUU/Pa3Nm+KKybnnAP775/6+i+9ZEJ1\n8MFw0klw//0Z3Z7IIRITIURSNm+G2lo49dTUZUaMgP/5H5g4ES6+OHV6lS1b4vejURg/3hMNN9bR\n2grXXusd//jjrm2MRuGss6ChAS68ENatS39fIj9ITIQQSWltteYjd0xJOroawJh4jtZWExNXfNav\nt/W8efEik+7abrwk3fVF/pGYCCGSEo1a/q2guLm6kuEGxt11NGpxFn9sBGwmxzFjrItvkGC6xKR0\nkJgIIZLif1AHoauHeWL34cRmLn+9Xr28c+3cacfcdVc2DhpkvcFSlRX5RWIihEhKa2tmnkmfPvYg\n7+iw/dWrLeZywAHexFUnnGBpV6JRm39k40Y4+ujOIjRsmB2fPdv2b7ml8/VaWizgPmyY7ffsaZ7N\nf/93R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FrrguL7WAd\nT64EdvmOhcn+GCaGrwPfdI6Fxf4xQCvwG2A2cA/WMSgs9vv5IpZpBHJkfzmJSazYBuQIt793V5+X\nAu7A0UuBTQmflfI97MKa6UYAR2Bv+H5K2faTgSjW3p2qJ2Mp2w9wGPYCciLwHazZ108p298TOAjL\nF3gQ0E7n1o9Stt+lFjgFeCTJZ922v5zEZAXW/ucyknhVLWXWED+AM+psJ97TCOdYsanBhOR+rJkL\nwncPG7Eu7AcTHts/jeW0W4y9VR6N/Q3CYj9YOz3YG/7jWP6+sNi/3Fn+6ew/ionKasJhv8uJwBvY\n3wDC8/0XjK4GSJYao+kcgM9kAGcxqQJ+hzW3+AnDPTTg9VSpA/4GHEM4bE/kSLyYSVjs7w30dbbr\ngf/D2u7DYj/Yb2ZvZ3sqZnuY7AdLuHuubz9s9heEVAMkS4kZWH6xbViM5zwyH8BZTA7Hmorewuti\nOJlw3MP+WFv3W1j31Cud42GwPZEj8XpzhcX+Mdh3/xbWrdz9Hw2L/QCfwjyTt4E/YEH5MNlfj03d\n0dd3LEz2CyGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEKLc+X+LTdyDrkqycQAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7efd4ec43780>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "g.plot_reward(smoothing=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "session.run(current_controller.target_network_update)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.00824914, -0.04792793,  0.08260646, ..., -0.00135659,\n",
       "        -0.0149605 , -0.00065048],\n",
       "       [ 0.04895933, -0.01720949,  0.03015076, ...,  0.04350275,\n",
       "        -0.00071916, -0.00507376],\n",
       "       [-0.03408033, -0.00734746, -0.07286905, ...,  0.06636748,\n",
       "         0.0507561 ,  0.04723936],\n",
       "       ..., \n",
       "       [-0.01454929, -0.00313209,  0.02152171, ...,  0.01723659,\n",
       "        -0.01757577, -0.02262094],\n",
       "       [ 0.03226471, -0.09545884,  0.01721121, ...,  0.0179732 ,\n",
       "        -0.01188065,  0.03430547],\n",
       "       [ 0.02971489,  0.06272104, -0.05087573, ..., -0.00265156,\n",
       "        -0.00139228,  0.01183042]], dtype=float32)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_controller.q_network.input_layer.Ws[0].eval()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.00792486, -0.04620561,  0.0822738 , ..., -0.00077494,\n",
       "        -0.0152533 , -0.0006482 ],\n",
       "       [ 0.04957085, -0.01709681,  0.03076575, ...,  0.04224423,\n",
       "        -0.00178666, -0.0045335 ],\n",
       "       [-0.03365552, -0.00761211, -0.07296719, ...,  0.06496961,\n",
       "         0.04951147,  0.04784767],\n",
       "       ..., \n",
       "       [-0.01839499, -0.00162295,  0.02568982, ...,  0.01739434,\n",
       "        -0.0198904 , -0.01868791],\n",
       "       [ 0.03405851, -0.09418759,  0.01544813, ...,  0.01676139,\n",
       "        -0.00888498,  0.03387775],\n",
       "       [ 0.0298653 ,  0.06385598, -0.05152962, ..., -0.00786654,\n",
       "        -0.00157313,  0.01064544]], dtype=float32)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_controller.target_q_network.input_layer.Ws[0].eval()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Visualizing what the agent is seeing\n",
    "\n",
    "Starting with the ray pointing all the way right, we have one row per ray in clockwise order.\n",
    "The numbers for each ray are the following:\n",
    "- first three numbers are normalized distances to the closest visible (intersecting with the ray) object. If no object is visible then all of them are $1$. If there's many objects in sight, then only the closest one is visible. The numbers represent distance to friend, enemy and wall in order.\n",
    "- the last two numbers represent the speed of moving object (x and y components). Speed of wall is ... zero.\n",
    "\n",
    "Finally the last two numbers in the representation correspond to speed of the hero."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1.00 0.55 1.00 -0.42 -0.40]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 0.83 1.00 0.42 0.63]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 0.44 1.00 -0.18 0.76]\n",
      " [1.00 0.46 1.00 -0.18 0.76]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [0.89 1.00 1.00 -0.95 0.78]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 0.44 1.00 0.45 -0.81]\n",
      " [1.00 0.20 1.00 -0.64 0.14]\n",
      " [1.00 0.19 1.00 -0.64 0.14]\n",
      " [1.00 0.21 1.00 -0.64 0.14]\n",
      " [1.00 0.57 1.00 0.56 0.78]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 0.92 1.00 0.41 0.77]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]\n",
      " [1.00 1.00 1.00 0.00 0.00]]\n",
      "[1.00 -0.94 -0.25 0.46]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<?xml version=\"1.0\"?>\n",
       "\n",
       "<svg height=\"580\" width=\"720\" >\n",
       "\n",
       " <g style=\"fill-opacity:1.0; stroke:black;\n",
       "\n",
       "  stroke-width:1;\">\n",
       "\n",
       "  <rect x=\"10\" y=\"10\" height=\"500\"\n",
       "\n",
       "        width=\"700\" style=\"fill:none;\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"393\" y2=\"375\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"391\" y2=\"399\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"384\" y2=\"421\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"373\" y2=\"442\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"358\" y2=\"460\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"340\" y2=\"475\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"319\" y2=\"486\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"296\" y2=\"493\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"273\" y2=\"495\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"250\" y2=\"493\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"227\" y2=\"486\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"206\" y2=\"475\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"188\" y2=\"460\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"173\" y2=\"442\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"162\" y2=\"421\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"155\" y2=\"399\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"153\" y2=\"375\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"155\" y2=\"352\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"162\" y2=\"329\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"173\" y2=\"309\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"188\" y2=\"291\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"206\" y2=\"276\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"227\" y2=\"265\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"250\" y2=\"258\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"273\" y2=\"255\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"296\" y2=\"258\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"319\" y2=\"265\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"340\" y2=\"276\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"358\" y2=\"291\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"373\" y2=\"309\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"384\" y2=\"329\" />\n",
       "\n",
       "  <line x1=\"273\" y1=\"375\" x2=\"391\" y2=\"352\" />\n",
       "\n",
       "  <circle cx=\"43\" cy=\"36\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"526\" cy=\"393\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"348\" cy=\"371\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"228\" cy=\"194\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"372\" cy=\"100\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"424\" cy=\"447\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"238\" cy=\"323\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"648\" cy=\"158\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"62\" cy=\"397\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"276\" cy=\"89\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"353\" cy=\"440\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"466\" cy=\"458\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"691\" cy=\"217\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"441\" cy=\"84\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"360\" cy=\"303\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"21\" cy=\"155\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"136\" cy=\"33\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"604\" cy=\"461\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"116\" cy=\"287\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"521\" cy=\"20\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"283\" cy=\"272\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"265\" cy=\"343\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"480\" cy=\"244\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"655\" cy=\"465\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"682\" cy=\"347\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"666\" cy=\"431\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"207\" cy=\"40\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"279\" cy=\"302\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"118\" cy=\"488\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"212\" cy=\"383\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"623\" cy=\"305\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"378\" cy=\"42\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"125\" cy=\"30\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"263\" cy=\"338\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"79\" cy=\"376\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"238\" cy=\"100\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"508\" cy=\"35\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"270\" cy=\"102\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"269\" cy=\"281\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"685\" cy=\"55\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"247\" cy=\"164\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"121\" cy=\"214\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"542\" cy=\"123\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"668\" cy=\"57\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"484\" cy=\"476\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"228\" cy=\"297\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"293\" cy=\"61\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"382\" cy=\"49\" r=\"10\"\n",
       "\n",
       "          style=\"fill:red;\" />\n",
       "\n",
       "  <circle cx=\"187\" cy=\"223\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"170\" cy=\"326\" r=\"10\"\n",
       "\n",
       "          style=\"fill:green;\" />\n",
       "\n",
       "  <circle cx=\"273\" cy=\"375\" r=\"10\"\n",
       "\n",
       "          style=\"fill:yellow;\" />\n",
       "\n",
       "  <text x=\"10\" y=\"535\" font-size=\"15\">\n",
       "\n",
       "   nearest wall = 124.1\n",
       "\n",
       "  </text>\n",
       "\n",
       "  <text x=\"10\" y=\"555\" font-size=\"15\">\n",
       "\n",
       "   reward       = 0.0\n",
       "\n",
       "  </text>\n",
       "\n",
       "  <text x=\"10\" y=\"575\" font-size=\"15\">\n",
       "\n",
       "   objects eaten => friend: 192, enemy: 144\n",
       "\n",
       "  </text>\n",
       "\n",
       " </g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<tf_rl.utils.svg.Scene at 0x7efd4c153dd8>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g.__class__ = KarpathyGame\n",
    "np.set_printoptions(formatter={'float': (lambda x: '%.2f' % (x,))})\n",
    "x = g.observe()\n",
    "new_shape = (x[:-4].shape[0]//g.eye_observation_size, g.eye_observation_size)\n",
    "print(x[:-4].reshape(new_shape))\n",
    "print(x[-4:])\n",
    "g.to_html()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
